// BluetoothDevice.java
package v2;

/**
 * 蓝牙设备信息类
 */
public class BluetoothDevice {
    private String macAddress;
    private String name;
    private boolean connected;
    private short rssi;
    private long lastSeen;

    public BluetoothDevice(String macAddress) {
        this.macAddress = macAddress;
        this.lastSeen = System.currentTimeMillis();
    }

    // Getter 和 Setter 方法
    public String getMacAddress() { return macAddress; }
    public void setMacAddress(String macAddress) { this.macAddress = macAddress; }

    public String getName() { return name; }
    public void setName(String name) { this.name = name; }

    public boolean isConnected() { return connected; }
    public void setConnected(boolean connected) {
        this.connected = connected;
        this.lastSeen = System.currentTimeMillis();
    }

    public short getRssi() { return rssi; }
    public void setRssi(short rssi) { this.rssi = rssi; }

    public long getLastSeen() { return lastSeen; }
    public void setLastSeen(long lastSeen) { this.lastSeen = lastSeen; }

    @Override
    public String toString() {
        return String.format("BluetoothDevice{mac='%s', name='%s', connected=%s, rssi=%d}",
                macAddress, name, connected, rssi);
    }
}